// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import LandingPage from '@/components/LandingPage'
import 'normalize.css/normalize.css'
import getQueryParam from '@/util/getQueryParam'

Vue.config.productionTip = false
Vue.component('landing-page', LandingPage)
/* eslint-disable no-new */
var _pageId = getQueryParam('_id')
if (!_pageId) {
  alert('访问错误')
}
var xmlhttp = new XMLHttpRequest()
if (xmlhttp) {
  xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
      var page = JSON.parse(xmlhttp.responseText)
      new Vue({
        el: '#app',
        data: page,
        template: '<div id="app"><landing-page :p-items="matirials" :style="pageHeight"></landing-page></div>'
      })
    }
  }
  xmlhttp.open('GET', 'http://localhost:3100/page/' + _pageId, true)
  xmlhttp.send(null)
}
